import axios from "axios";
import qs from 'querystring'
let baseUrl = '/api/'
//请求拦截器
axios.interceptors.request.use((req) => {
    return req
})
//响应拦截器
axios.interceptors.response.use(res => {
    return res.data
})
//封装的get方法
export const get = (url, params = {}) => {
    return axios.get(baseUrl+url,{params})
}
//封装的post方法
export const post = (url, params = {}) => {
    let data = qs.stringify(params)
    return axios.post(baseUrl+url,data)
}